﻿using System.Data.SqlClient;

namespace StreetPacMan.Server.Tests
{
    internal static class Cleaner
    {
        public static void Clear()
        {
            using (var sqlConnection = new SqlConnection(new ConnectionStringProvider().GetConnectionString()))
            using (var pacManDataContext = new PacManDataContext(sqlConnection))
            {
                pacManDataContext.Games.DeleteAllOnSubmit(pacManDataContext.Games);
                pacManDataContext.Entities.DeleteAllOnSubmit(pacManDataContext.Entities);
                pacManDataContext.Orders.DeleteAllOnSubmit(pacManDataContext.Orders);
                pacManDataContext.SubmitChanges();
            }
        }
    }
}